package com.mrjy.common.config.listener;

import javax.servlet.ServletRequestEvent;
import javax.servlet.ServletRequestListener;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * 添加GetHttpSessionConfigurator类后如果不出意外，会报一个空指针的，因为无法获取session，若httpSession不为空则允许
 * 因此需要添加当前类并配置((HttpServletRequest) sre.getServletRequest()).getSession();
 * @author Administrator
 *
 */
public class RequestListener implements ServletRequestListener {

	@Override
	public void requestDestroyed(ServletRequestEvent arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void requestInitialized(ServletRequestEvent sre) {
		// TODO Auto-generated method stub
		((HttpServletRequest) sre.getServletRequest()).getSession(false);
	}

}
